home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PVDRIVER
/
PRWRI12.ZIP
/
PRWRI12.WCM
< prev
next >
Wrap
Text File
|
1993-07-18
|
3KB
|
144 lines
//////////////////
// PRWRI12.WCM
// PrintWrite 1.2
//////////////////
// ASSIGN ICON
hicon=loadiconfile("prwri.ico")
if(hicon<>0)holdicon=seticon(hmain,hicon)
// ASK FOR FILENAME
ans=askbox("Enter name of file (no extension)"," ")
if ans+a==a
exit
var1="Write - "
var2=ans
var3=".wri"
file=var1+var2+var3
appactivate(file)
// MAKE SURE ANSWER IS VALID
test=getwindowhandle(file)
if test=0
do
do
ans=askbox("Sorry, that file is not active. Enter name of active Write file (without .wri extension)"," ")
if ans+a==a
exit
var1="Write - "
var2=ans
var3=".wri"
file=var1+var2+var3
appactivate(file)
end
test=getwindowhandle(file)
if test=0
do
msgbox("Sorry, that is an invalid answer. Make sure that Write is running, check filename and try again.","PrintWrite",0)
exit
end
end
// JUMP TO END OF DOCUMENT
delay(100)
sendkeys("^{end}")
delay(500)
// ASK FOR DOCUMENT LENGTH
pages=askbox("How many pages?"," ")
// MAKE SURE A NUMBER HAS BEEN ENTERED
if pages+a==a
exit
if pages=0
exit
if pages=(" ")
do
pages=askbox("Please enter the number of pages you wish to print."," ")
if pages+a==a
exit
if pages=0
exit
if pages=(" ")
do
msgbox("Sorry, that is an invalid answer. Decide how many pages you want to print and try again.","PrintWrite",0)
exit
end
end
pages=pages-1
// ASK PAGE TO START ON
first=askbox("Start on page","1")
// MAKE SURE A NUMBER HAS BEEN ENTERED
if first+a==a
exit
if first=0
exit
if first=" "
exit
count=first
// PRINT FIRST (SELECTED) PAGE
appactivate(file)
delay(100)
sendkeys("%f")
sendkeys("p")
sendkeys("p")
sendkeys(count)
sendkeys("{tab}")
sendkeys(count)
sendkeys("{enter}")
winact=getappactive()
while(winact="Write")
do
winact = getappactive()
delay (1000)
end
// CHECK NUMBER OF PAGES PRINTED SO FAR
count=first-0
while count<pages
do
count=count+2
// PRINT SECOND (SELECTED) AND SUBSEQUENT PAGES
appactivate(file)
delay(100)
sendkeys("%f")
sendkeys("p")
sendkeys("{tab}")
sendkeys(count)
sendkeys("{tab}")
sendkeys(count)
sendkeys("{enter}")
winact=getappactive()
while(winact="Write")
do
winact=getappactive()
delay(1000)
end
end
// PROMPT FOR READINESS TO PRINT ALTERNATE PAGES
reply=msgbox("Ready to continue print job?","Pause",1)
if reply=2
exit
if reply=1
// CHECK NUMBER OF PAGES PRINTED SO FAR
count=first-1
while count<pages
do
count=count+2
// PRINT ALTERNATE PAGES
appactivate(file)
delay(100)
sendkeys("%f")
sendkeys("p")
sendkeys("{tab}")
sendkeys(count)
sendkeys("{tab}")
sendkeys(count)
sendkeys("{enter}")
winact=getappactive()
while(winact = "Write")
do
winact=getappactive()
delay(1000)
end
end
// GOODBYE
msgbox("Thank you for using WinCmd and PrintWrite!","PrintWrite",0)
appactivate(file)
sendkeys("^{home}")
exit